package com.k.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.k.demo.entity.ConstantTerm;

@Mapper
public interface ConstantTermMapper {
	
	//查找全部
	@Select("select * from constant_term where is_delete = 1")
	List<ConstantTerm> getAll();
	
	//根据id查找
	@Select("select * from constant_term where constant_term_id=#{constant_term_id} and is_delete = 1")
	ConstantTerm getById(int constant_term_id);
	
	//根据对象查找(有的就查找  没有就不查找)
	List<ConstantTerm> getConstantTerm(ConstantTerm constantTerm);
	
	//根据id假删除
	@Update("Update constant_term set is_delete=0 where constant_term_id=#{constant_term_id}")
	int falseDeleteById(int constant_term_id);

	//真删除
	@Delete("delete from constant_term where constant_term_id=#{constant_term_id}")
	int trueDeleteById(int constant_term_id);
	
	//批量删除
	boolean deleteByGroup(List<Integer> deletelist);
	
	//常数项修改
	int modifyConstantTerm(ConstantTerm constantTerm);
	
	//常数项增加
	int addConstantTerm(ConstantTerm constantTerm);
	
	//根据常数项的类别进行查找
	@Select("select * from constant_term where constant_term_kind = #{constant_term_kind} and is_delete=1")
	List <ConstantTerm> getByConstantTermKind(int constant_term_kind);
	
}
